<!DOCTYPE html>
<meta charset="utf-8">
<title>Typed Arrays Test: Uint8ClampedArray constructor</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="help" href="http://www.khronos.org/registry/typedarray/specs/latest/#7.1">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>

test(function() {
  var obj = new Uint8ClampedArray(new Uint8ClampedArray(8));
  assert_true(obj instanceof Uint8ClampedArray, "The constructor return Uint8ClampedArray");
  assert_equals(obj.length, 8, "The length of Uint8ClampedArray");
}, "Check if the constructor(Uint8ClampedArray) create new Uint8ClampedArray");

test(function() {
  var obj = new Uint8ClampedArray(new ArrayBuffer(8));
  assert_true(obj instanceof Uint8ClampedArray, "The constructor return Uint8ClampedArray");
  assert_equals(obj.length, 8, "The length of Uint8ClampedArray");
}, "Check if the constructor(ArrayBuffer) create new Uint8ClampedArray");

test(function() {
  var obj = new Uint8ClampedArray(new ArrayBuffer(8), 2);
  assert_true(obj instanceof Uint8ClampedArray, "The constructor return object Uint8ClampedArray");
  assert_equals(obj.length, 6, "The length of Uint8ClampedArray");
}, "Check if the constructor(ArrayBuffer, byteOffset) create new Uint8ClampedArray");

test(function() {
  var obj = new Uint8ClampedArray(new ArrayBuffer(8), 2, 4);
  assert_true(obj instanceof Uint8ClampedArray, "The constructor return object Uint8ClampedArray");
  assert_equals(obj.length, 4, "The length of Uint8ClampedArray");
}, "Check if the constructor(ArrayBuffer, byteOffset, length) create new Uint8ClampedArray");

</script>
